import { request } from "@/utils/request.ts";

export const getRoleList = async (data: any) => {
  return await request.post<{
    list: API.RoleObject[];
    pagination: API.PaginationObject;
  }>("/admin/base/sys/role/page", data);
};

export const delRole = (ids: number[]) => {
  return request.post("/admin/base/sys/role/delete", {
    ids,
  });
};

export function addRole(data: any) {
  return request.post("/admin/base/sys/role/add", {
    // name: "11",
    // label: "11",
    // remark: "111",
    // menuIdList: [447, 448, 449, 450, 451, 452],
    ...data,
    relevance: 1,
    departmentIdList: [],
  });
}

export function editRole(data: any) {
  return request.post("/admin/base/sys/role/update", {
    ...data,
    relevance: 1,
    departmentIdList: [],
  });
}
